package com.wyvoid.core.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

public class SecureTag extends TagSupport {
    private String roles;
    //final StripesSecurityManager securityManager = StripesSecurityFilter.getSecurityManager();

    public SecureTag() {
        super();
        initValues();
    }

    public String getRoles() {
        return roles;
    }

    public void setRoles(String roles) {
        this.roles = roles;
    }

    public int doStartTag() throws JspException {
        if (roles == null || roles.length() < 1)
            return SKIP_BODY;

       /* List<Role> anyRoles = new ArrayList<Role>();
        List<String> anyRolesStr = Arrays.asList(roles.trim().split(","));
        for (String anyRoleStr : anyRolesStr) {
            Role anyRole = Role.valueOf(anyRoleStr);
            anyRoles.add(anyRole);
        }*/
        /*if (securityManager.isUserInRole(anyRoles, ((HttpServletRequest) pageContext.getRequest()), ((HttpServletResponse) pageContext.getResponse())))
            return EVAL_BODY_INCLUDE;*/

        return SKIP_BODY;
    }

    private void initValues() {
        roles = "";
    }
}
